﻿using HandyControl.Controls;
using Microsoft.Extensions.Logging;
using ShanNiang.Service.Enumerate;
using ShanNiang.Service.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Markup;

namespace ShanNiang.Mvvm.UiServices
{
    public class UiService : IUiService
    {
        private readonly ISoundService _soundService;
        private readonly ILogger<UiService> _logger;

        public UiService(ISoundService soundService, ILogger<UiService> logger)
        {
            _soundService = soundService;
            _logger = logger;
        }

        public void GrowlError(string message, CodeType codeType, Exception? exception)
        {
            _logger.LogError(exception, message);
            Growl.Error(message);
            _soundService.PlayError(codeType);
        }

        public void GrowlInfo(string message, CodeType codeType)
        {
            _logger.LogInformation(message);
            Growl.Info(message);
            _soundService.PlayInfo(codeType);
        }

        public void GrowlSuccess(string message, CodeType codeType)
        {
            _logger.LogDebug(message);
            Growl.Success(message);
            _soundService.PlaySuccess(codeType);
        }

        public void GrowlWarning(string message, CodeType codeType, Exception? exception)
        {
            _logger.LogWarning(exception, message);
            Growl.Warning(message);
            _soundService.PlayWanning(codeType);
        }


    }
}
